package com.kingdee.controller;

import com.kingdee.Utils.TimeTransfer;
import com.kingdee.model.WorkTime;

/**
 * Created by Administrator on 2016/12/27.
 */
public class CalculateWorkTime {

    private static WorkTime workTime = new WorkTime();

    public static int morningWorkTime(String comingTime) {

        workTime.setMorningComeTime(comingTime);
        int morningWorkTime = TimeTransfer.string2Int(workTime.getMorningGoTime()) - TimeTransfer.string2Int(workTime.getMorningComeTime());
        return morningWorkTime;
    }

    public static int afternoonWorkTime(String goTime) {

        workTime.setAfternoonGoTime(goTime);
        int afternoonWorkTime = TimeTransfer.string2Int(workTime.getAfternoonGoTime()) - TimeTransfer.string2Int(workTime.getAfternoonComeTime());
        return afternoonWorkTime;
    }


    public static int allDayWorkTimeInt(String comingTime, String goTime) {
        int morningTime = morningWorkTime(comingTime);
        int afternoonTime = afternoonWorkTime(goTime);
        return morningTime + afternoonTime;
    }

    public static String allDayWorkTimeString(String comingTime, String goTime) {
        int morningTime = morningWorkTime(comingTime);
        int afternoonTime = afternoonWorkTime(goTime);
        return TimeTransfer.int2String(morningTime + afternoonTime);
    }


    public static void main(String[] args) {
        String morningCome = "09:05";
        String affternoonGo = "20:50";
        allDayWorkTimeString(morningCome, affternoonGo);
    }


}
